﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MidwayBattle.Drawing;

namespace MidwayBattle
{
    /// <summary>
    /// Logique d'interaction pour PlayersWindow.xaml
    /// </summary>
    public partial class PlayersWindow : Window
    {
        private Drawings Painter = new Drawings();
        private MainWindow main;

        public PlayersWindow(MainWindow _main)
        {
            InitializeComponent();
            main = _main;
        }

        private void CloseBtn_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void NextBtn_Click(object sender, RoutedEventArgs e)
        {
            if (PlayersListBox.SelectedIndex < 0)
                MessageBox.Show("You must select a player first !");
            else
            {
                /*
                ConnectionWindow conWin = new ConnectionWindow(main, CustomDefines.OBJECTIVE_CONNECT);                
                conWin.Show();
                 * */

                Painter.SetGameContentVisibility(main.AbstractGrid, main.GeneralViewBox, true);
                // Adapting menus
                main.itemConnect.IsEnabled = false;
                main.itemDisconnect.IsEnabled = true;
                main.itemNewGame.IsEnabled = true;
                main.itemOpenGame.IsEnabled = true;
                main.itemDeleteGame.IsEnabled = true;
                main.itemEditPlayer.IsEnabled = true;
                main.itemLoadPlayer.IsEnabled = true;
                main.itemRemovePlayer.IsEnabled = true;

                this.Close();
            }
        }

        private void PlayersListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DeletePlayerBtn.IsEnabled = (PlayersListBox.SelectedIndex >= 0);
            EditPlayerBtn.IsEnabled = (PlayersListBox.SelectedIndex >= 0);
        }

      

    }
}
